package com.sourcespro.mybatis.config;

import com.baomidou.mybatisplus.core.injector.ISqlInjector;
import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector;
import com.sourcespro.mybatis.SpringUtil;
import com.sourcespro.mybatis.dao.BaseTreeMapper;
import com.sourcespro.mybatis.interceptor.LRTreeInterceptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;

/**
 * lr-tree
 *
 * @author zhanghaowei
 * @date 2018/10/31
 */
@Configuration
public class MybatisConfiguration {
    private static final Logger logger = LoggerFactory.getLogger(MybatisConfiguration.class);

    @Bean
    public LRTreeInterceptor treeInterceptor(){
        logger.info("初始化左右值树形结构mybatis插件");
        return new LRTreeInterceptor();
    }

    @Bean
    public ISqlInjector sqlInjector() {
        logger.info("初始逻辑删除插件");
        return new LogicSqlInjector();
    }

}
